#include <iostream>
#include <string>
using namespace std;

int main()
{
    string s;
    cin >> s;
    string stack;//ջ

    for (auto ch : s)
    {
        if (stack.size() && stack.back() == ch)
        {
            stack.pop_back();
        }
        else
        {
            stack += ch;
        }
    }
    cout << (0 == stack.size() ? "0" : stack) << endl;
    return 0;
}